<template>
	<div class="asklist">
		<div class="title">
			{{loadData.name}}
		</div>
		<van-divider />
		<div class="list-item" v-for="item in list" :key="item.id"  @click="detail(item)">
			<div class="title">
				<div class="left">标题：</div>
				<div class="right">
					{{item.title}}
				</div>
			</div>
			<div v-html="item.postcontent"></div>
			<p class="source">
				<span>{{item.comment}}人回复</span>
				<span>{{item.reading}}人浏览</span>
			</p>
			<p class="time">发布时间：{{item.publishtime_text}}</p>
		</div>
	</div>
</template>

<script>
	import showimg from "@/assets/img/showimg.png"
	export default {
		name: "asklist",
		components: {

		},
		data() {
			return {
				showimg:showimg,
				loadData:{},
				list:{},
				limit:10,
				page:1,
				hot:this.$route.query.hot||'',
				answered:this.$route.query.answered||''
			}
		},
		mounted() {
			this.loadData = this.$localStorage.get("secondLevel")
			this.getData()
		},
		methods:{
			todetail(item){
				this.$router.push({name:'askdetail',query:{id:item.id}})
			},
			getData(){
				
				let detailData = {
					site_id:this.$localStorage.get("site_id"),
					limit:this.limit,
					page:this.page,
					hot:this.hot,
					answered:this.answered
				}
				this.$api.home.askingList(detailData).then(res => {
					// 执行某些操作
					if (res.code == 1) {
						this.list = res.data.data
					}
				
				})
			},
			detail(item){
				this.$router.push({name:'askdetail',query:{id:item.id}})
			}
		}


	}
</script>

<style scoped lang="less">
	.asklist {
		padding: 1.13rem 0.78rem;
		background: #fff;

		.title {
			font-size: 0.94rem;
			font-family: PingFang SC;
			font-weight: bold;
			color: rgba(38, 38, 38, 1);
		}

		.list-item {
			margin-bottom: 2.13rem;
			.title {
				display: flex;
				align-items: flex-start;
				justify-content: flex-start;
				font-size: 0.88rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(0, 0, 0, 1);
				line-height: 1.25em;
			
				.left {
					white-space: nowrap;
				}
			}
			
			.time {
				font-size: 0.81rem;
				font-family: PingFang SC;
				font-weight: 500;
				color: rgba(106, 106, 106, 1);
			
				margin-top: 1.09rem;
				margin-bottom: 1.69rem;
			}
			
			.source {
				padding-right: 3.47rem;
				display: flex;
				justify-content: space-between;
				margin-top: 2.72rem;
			
				span {
					font-size: 0.81rem;
					font-family: PingFang SC;
					font-weight: 500;
					color: rgba(106, 106, 106, 1);
			
				}
			}

		}
	}
</style>
